package com.muchen.partnermatching.controller;

import com.muchen.partnermatching.model.request.EmailCodeRequest;
import com.muchen.partnermatching.model.vo.R;
import com.muchen.partnermatching.service.CommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/common")
//@CrossOrigin(origins = "http://www.muchen-demo.cn/", allowCredentials = "true")
@CrossOrigin
public class CommonController {

    @Autowired
    private CommonService commonService;

    // 权限码请求接口
    @CrossOrigin
    @PostMapping("code/request")
    public R getRequestPermissionCode(@RequestBody String emailJson) {
        return commonService.getRequestPermissionCode(emailJson);
    }

    // 邮箱验证码接口
    @CrossOrigin
    @PostMapping("code/email")
    public R sendEmailCode(@RequestBody EmailCodeRequest emailCodeRequest) {
        return commonService.sendEmailCode(emailCodeRequest);
    }
}
